<template>
	<div class="app-container">
		<GridRankLayout
			:trackSwitchList="trackSwitchList"
			:rankList="rankList"
			:cardList="fanjuCardList"
			title="番剧"
			title_icon="icon-fanju"
		>
			<template #header_right>
				<Button icon_end="icon-arrow-right" btn_text="新番时间表"></Button>
				<Button icon_end="icon-arrow-right" btn_text="查看更多"></Button>
			</template>
		</GridRankLayout>
		<GridRankLayout :cardList="fanjudongtaiCardList" title="番剧动态">
			<template #header_right>
				<Button icon_front="icon-weibiaoti--" btn_text="换一换"></Button>
				<Button icon_end="icon-arrow-right" btn_text="查看更多"></Button>
			</template>
		</GridRankLayout>
	</div>
</template>

<script>
import GridRankLayout from '@/components/GridRankLayout'
import Button from '@/components/Button'
// 导入axios的包
import axios from 'axios'
export default {
	name: 'App',
	components: {
		GridRankLayout,
		Button
	},
	mounted() {//页面挂载之后
		const that = this;
		//https://api.bilibili.com
		var url = '/aabbcc/pgc/web/timeline/v2?day_before=0&day_after=6&season_type=1';
		axios.get(url)
		.then(function (response) {
			if(response.status == 200){
				that.fanjuCardList = response.data.result.latest;
			}else{
				alert("跨域请求失败");
			}
			console.log(response);
		})
		.catch(function (error) {
			console.log(error);
		});

		document.title = '哔哩哔哩 (゜-゜)つロ 干杯~-bilibili';
	},
	data() {
		return {
			// 菜单栏数据
			trackSwitchList: {
				current: 1,
				trackList: [
					{ id: 1, text: '最近更新' },
					{ id: 2, text: '周一' },
					{ id: 3, text: '周二' },
					{ id: 4, text: '周三' },
					{ id: 5, text: '周四' },
					{ id: 6, text: '周五' },
					{ id: 7, text: '周六' },
					{ id: 8, text: '周日' }
				]
			},
			// 排行榜数据
			rankList: [],
			// 番剧卡片数据
			fanjuCardList: [],
			// 番剧动态卡片数据
			fanjudongtaiCardList: []
		};
	}
};
</script>

<style></style>
